package com.acarter.scenemonitor.propertydescriptor.enums;
/**
 * <p>Title</p>

/**
 * Enumerates the permissible Z-buffer functions.
 * 
 * @author Andrew Carter
 */
public enum E_ZBufferFunction {

	/** Depth comparison never passes. */
	CF_NEVER("CF_NEVER", 0),

	/** Passes if the incoming value is less than the stored value. */
	CF_LESS("CF_LESS", 1),

	/** Passes if the incoming value is the same as the stored value. */
	CF_EQUAL("CF_EQUAL", 2),

	/** Passes if the incoming value is less than or equal to the stored value. */
	CF_LEQUAL("CF_LEQUAL", 3),

	/** Passes if the incoming value is greater than the stored value. */
	CF_GREATER("CF_GREATER", 4),

	/** Passes if the incoming value is not equal to the stored value. */
	CF_NOTEQUAL("CF_NOTEQUAL", 5),

	/** Passes if the incoming value is greater than or equal to the stored value. */
	CF_GEQUAL("CF_GEQUAL", 6),

	/** Depth comparison always passes. */
	CF_ALWAYS("CF_ALWAYS", 7);

	/** String representation of the enum value */
	private String name;

	/** Integer value of the enum value */
	private int value;

	/**
	 * Private constructor.
	 * 
	 * @param value
	 *            String literal of the enum
	 */
	private E_ZBufferFunction(String name, int value) {

		this.name = name;
		this.value = value;
	}

	/**
	 * Returns the enum constant matching the name string.
	 * 
	 * @param name
	 *            string value of enum constant
	 * @return matching enum constant or null
	 */
	public static E_ZBufferFunction getConstant(String name) {

		for (E_ZBufferFunction constant : E_ZBufferFunction.values()) {

			if (constant.toString().compareToIgnoreCase(name) == 0)
				return constant;
		}

		return null;
	}

	/**
	 * Returns the enum constant matching the type value.
	 * 
	 * @param type
	 *            type value of enum constant
	 * @return matching enum constant or null
	 */
	public static E_ZBufferFunction getConstant(int type) {

		for (E_ZBufferFunction constant : E_ZBufferFunction.values()) {

			if (constant.getType() == type)
				return constant;
		}

		return null;
	}

	/**
	 * Returns the string value of the constant.
	 */
	public String toString() {

		return name;
	}
	
	/**
	 * Returns the integer value of the constant.
	 * @return 
	 */
	public int getType() {
		
		return value;
	}
}
